﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace ImageRecognition2.CustomControls
{
    /// <summary>
    /// This is a custom control item. 
    /// Use this for the CustomControlListBox
    /// </summary>
    public class ListBoxControlItem
    {
        /// <summary>
        /// 
        /// </summary>
        private IEnumerable<Control> m_aControl = null;
        protected int m_nCompleteControlWidth = -1;
        protected int m_nCount = 0;

        /// <summary>
        /// Initializes a new instance of the <see cref="ListBoxControlItem"/> class.
        /// </summary>
        /// <param name="_control">The _control.</param>
        public ListBoxControlItem(Control _control)
        {
            m_aControl = new List<Control>() { _control };
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ListBoxControlItem"/> class.
        /// </summary>
        /// <param name="_aControl">The _a control.</param>
        public ListBoxControlItem(IEnumerable<Control> _aControl)
        {
            m_aControl = _aControl;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ListBoxControlItem"/> class.
        /// </summary>
        /// <param name="_aControl">The _a control.</param>
        public ListBoxControlItem(params Control[] _aControl)
        {
            m_aControl = _aControl;
        }

        /// <summary>
        /// Gets or sets the width of the complete control.
        /// </summary>
        /// <value>The width of the complete control.</value>
        public int CompleteControlWidth
        {
            get { return m_nCompleteControlWidth; }
            set { m_nCompleteControlWidth = value; }
        }

        /// <summary>
        /// Gets or sets the count.
        /// </summary>
        /// <value>The count.</value>
        public int Count
        {
            get { return m_nCount; }
            set { m_nCount = value; }
        }

        /// <summary>
        /// Gets or sets the control.
        /// </summary>
        /// <value>The control.</value>
        public IEnumerable<Control> Controls
        {
            get { return m_aControl; }
            set { m_aControl = value; }
        }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            string sText = string.Empty;
            foreach (Control control in m_aControl)
            {
                sText += control.Text;
            }
            return sText;
        }
    }
}
